// 引入api
import { reqGoodDetail } from '@/api/index';
const state = {
    // 商品分类的数据
    goodDetail: {}
};
const mutations = {
    GETGOODDETAIL: (state, goodDetail) => {
        state.goodDetail = goodDetail;
    }
};
const actions = {
    // getGoodDetail 类型的action
    getGoodDetail: async ({ state, commit, dispatch }, payload) => {
        let result = await reqGoodDetail(payload);
        commit("GETGOODDETAIL", result.data)
    }
};
const getters = {
    // 面包屑
    categoryView(state) {
        return state.goodDetail.categoryView || {}
    },
    // 商品描述的数据
    skuInfo(state) {
        return state.goodDetail.skuInfo || {};
    },
    // 商品销售属性
    saleAttrList(state) {
        return state.goodDetail.spuSaleAttrList || []
    }

};

export default {
    state,
    mutations,
    actions,
    getters,
}